package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the CUSTOMER database table.
 * 
 */
@Entity
public class Customer implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="CUSTOMER_ID")
	private long customerId;

	//bi-directional one-to-one association to Person
	@OneToOne
	@JoinColumn(name="CUSTOMER_ID")
	private Person person;

	//bi-directional many-to-one association to FactoryOrder
	@OneToMany(mappedBy="customer")
	private List<FactoryOrder> factoryOrders;

	public Customer() {
	}

	public long getCustomerId() {
		return this.customerId;
	}

	public void setCustomerId(long customerId) {
		this.customerId = customerId;
	}

	public Person getPerson() {
		return this.person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	
	public List<FactoryOrder> getFactoryOrders() {
		return this.factoryOrders;
	}

	public void setFactoryOrders(List<FactoryOrder> factoryOrders) {
		this.factoryOrders = factoryOrders;
	}

	
	public FactoryOrder addFactoryOrders(FactoryOrder factoryOrders) {
		getFactoryOrders().add(factoryOrders);
		factoryOrders.setCustomer(this);

		return factoryOrders;
	}

	public FactoryOrder removeFactoryOrders(FactoryOrder factoryOrders) {
		getFactoryOrders().remove(factoryOrders);
		factoryOrders.setCustomer(null);

		return factoryOrders;
	}
}